﻿<%@ Page Title="" Language="C#" MasterPageFile="~/Admin/AdminMaster.Master" AutoEventWireup="true" CodeBehind="EditProduct.aspx.cs" Inherits="ShoppingCartWEB.Admin.EditProduct" %>
<asp:Content ID="Content1" ContentPlaceHolderID="head" runat="server">
    <style type="text/css">
        .style1
        {
            width: 156px;
        }
    </style>
    <script language="javascript" type="text/javascript">
        function validate() {
            var result = false;
            var upfile = document.getElementById("FileUpload1").value;
            if (upfile != "") {
                var accept = "png,gif,jpg,jpeg".split(',');
                var getExtention = upfile.split('.');
                var extention = getExtention[getExtention.length - 1];
                for (i = 0; i < accept.length; i++) {
                    if (accept[i] == extention) {
                        result = true;
                        break;
                    }
                }
                if (!result) {
                    alert("allowed file extention are png,gif,jpg,jpeg");
                }
            }
            else {
                alert("select image to Upload");
            }
            return result;
        }
        
    </script>
</asp:Content>
<asp:Content ID="Content2" ContentPlaceHolderID="ContentPlaceHolder1" runat="server">
<table style="width: 100%;">
    <tr>
        <td class="style1">
            &nbsp;&nbsp; Product ID</td>
        <td class="style2">
            &nbsp;
            <asp:Label ID="lblID" runat="server" Text="ID"></asp:Label>
        </td>
        <td>
            &nbsp;
            </td>
    </tr>
    <tr>
        <td class="style1">
            &nbsp;
            Product Name :</td>
        <td class="style2">
            &nbsp;
            <asp:TextBox ID="txtName" runat="server"></asp:TextBox>
        </td>
        <td>
            &nbsp;
            <asp:RequiredFieldValidator ID="RequiredFieldValidator1" runat="server" 
                ControlToValidate="txtName" ErrorMessage="Enter product name " ForeColor="Red"></asp:RequiredFieldValidator>
        </td>
    </tr>
    <tr>
        <td class="style1">
            &nbsp;
            Category :</td>
        <td class="style2">
            &nbsp;
            <asp:DropDownList ID="ddlCategory" runat="server" Width="155px" Height="21px">
            </asp:DropDownList>
        </td>
        <td>
            &nbsp;
            <asp:RequiredFieldValidator ID="RequiredFieldValidator2" runat="server" 
                ControlToValidate="ddlCategory" ErrorMessage="Enter category" ForeColor="Red"></asp:RequiredFieldValidator>
        </td>
    </tr>
    <tr>
        <td class="style1">
            &nbsp;
            Supplier :
        </td>
        <td class="style2">
            &nbsp;
            <asp:DropDownList ID="ddlSupplier" runat="server" Height="21px" Width="153px">
            </asp:DropDownList>
        </td>
        <td>
            &nbsp;
            <asp:RequiredFieldValidator ID="RequiredFieldValidator3" runat="server" 
                ControlToValidate="ddlSupplier" ErrorMessage="Enter supplier" ForeColor="Red"></asp:RequiredFieldValidator>
        </td>
    </tr>
    <tr>
        <td class="style1">
            &nbsp;
            Product Price :&nbsp;
        </td>
        <td class="style2">
            &nbsp;
            <asp:TextBox ID="txtPrice" runat="server" Height="18px" Width="151px"></asp:TextBox>
        </td>
        <td>
            &nbsp;
            <asp:RequiredFieldValidator ID="RequiredFieldValidator4" runat="server" 
                ControlToValidate="txtPrice" ErrorMessage="Enter product price" ForeColor="Red"></asp:RequiredFieldValidator>
        </td>
    </tr>
    <tr>
        <td class="style1">
            &nbsp;
            Unit :</td>
        <td class="style2">
            &nbsp;
            <asp:TextBox ID="txtUnit" runat="server" Width="153px"></asp:TextBox>
        </td>
        <td>
            &nbsp;
            <asp:RequiredFieldValidator ID="RequiredFieldValidator5" runat="server" 
                ControlToValidate="txtUnit" ErrorMessage="enter unit product" ForeColor="Red"></asp:RequiredFieldValidator>
        </td>
    </tr>
    <tr>
        <td class="style1">
            &nbsp;
            Quantity:</td>
        <td class="style2">
            &nbsp;
            <asp:TextBox ID="txtQuantity" runat="server" Width="156px"></asp:TextBox>
        </td>
        <td>
            &nbsp;
            <asp:RequiredFieldValidator ID="RequiredFieldValidator6" runat="server" 
                ControlToValidate="txtQuantity" ErrorMessage="Enter quantity product" 
                ForeColor="Red"></asp:RequiredFieldValidator>
        </td>
    </tr>
    <tr>
        <td class="style1">
            &nbsp;
            Image :
        </td>
        <td class="style2">
            &nbsp;
            <asp:Image ID="imgProduct" runat="server" Height="129px" Width="171px" /><br />
            choose another image : 
            <asp:FileUpload ID="flImage" runat="server" style="margin-bottom: 0px"/>
        </td>
        <td>
            &nbsp;
                <asp:RegularExpressionValidator ID="RegularExpressionValidator1" runat="server" 
                ErrorMessage=" Only .jpg, png,jpeg,bmp...." ForeColor="Red" 
                ValidationExpression="^(([a-zA-Z]:)|(\\{2}\w+)\$?)(\\(\w[\w].*))(.jpg|.png|.jpeg|.gif|.jpe|.bmp)$" 
                ControlToValidate="flImage" SetFocusOnError="True" Display="Dynamic" ValidationGroup="Group1"></asp:RegularExpressionValidator>
        </td>
    </tr>
    <tr>
        <td class="style1">
            &nbsp;
            Decription</td>
        <td class="style2">
            &nbsp;
            <asp:TextBox ID="txtDecription" runat="server" Height="204px" Width="333px" 
                TextMode="MultiLine"></asp:TextBox>
        </td>
        <td>
            &nbsp;
            
        </td>
    </tr>
    <tr>
        <td class="style1">
            &nbsp;
        </td>
        <td class="style2">
           
            <asp:Button ID="btnSave" runat="server" onclick="btnSave_Click" Text="Save" />
        </td>
        <td>
            &nbsp;
        </td>
    </tr>
</table>
</asp:Content>
